using MicroMsg.Resource.@string;
using MicroMsg.Storage;
using MicroMsg.UI.Page;
using MicroMsg.UI.Util;
using System;
using System.Windows.Media;
namespace MicroMsg.Manager
{
	public class BindHintManager
	{
		public enum BindGuidType
		{
			BindQQ,
			BindPhone,
			BindFaceBook
		}
		private const string HintConversationType = "BindHint";
		public static void CreateNewBindHintConv()
		{
			if (!BindHintManager.isNeedCreate())
			{
				return;
			}
			Conversation conversation = new Conversation();
			conversation.strMsgType = "BindHint";
			conversation.nStatus = (int)BindHintManager.GetBindType();
			conversation.strUsrName = "BindHint@BindHint";
			StorageMgr.converation.vmethod_0(conversation);
			ConfigMgr.setBool("KeyBJustRegUser", false);
		}
		public static bool isNeedCreate()
		{
			return MainPage.IsRegisterFromFacebook || ConfigMgr.getBool("KeyBJustRegUser", false);
		}
		public static bool IsBindHintConv(Conversation conv)
		{
			return conv != null && conv.strMsgType == "BindHint";
		}
		public static BindHintManager.BindGuidType GetBindType()
		{
			Account curAccount = AccountMgr.getCurAccount();
			if (curAccount == null)
			{
				return BindHintManager.BindGuidType.BindQQ;
			}
			if (curAccount.nBindQQ != 0u)
			{
				return BindHintManager.BindGuidType.BindPhone;
			}
			if (BindHintManager.IsBindFaceBook() && string.IsNullOrEmpty(curAccount.strBindMobile))
			{
				return BindHintManager.BindGuidType.BindPhone;
			}
			if (!ToolFunction.checkIsChinaNumber(curAccount.strBindMobile))
			{
				return BindHintManager.BindGuidType.BindFaceBook;
			}
			return BindHintManager.BindGuidType.BindQQ;
		}
		public static bool IsBindFaceBook()
		{
			Account curAccount = AccountMgr.getCurAccount();
			return curAccount != null && curAccount.FaceBookFlag > 0u;
		}
		private static BindHintManager.BindGuidType GetTypeByconv(Conversation conv)
		{
			if (conv == null)
			{
				return BindHintManager.BindGuidType.BindQQ;
			}
			return (BindHintManager.BindGuidType)conv.nStatus;
		}
		public static void GoToBinding(BasePage page, Conversation conv)
		{
			BindHintManager.BindGuidType typeByconv = BindHintManager.GetTypeByconv(conv);
			if (typeByconv == BindHintManager.BindGuidType.BindQQ)
			{
				string text = "findFriend";
				ToolFunction.GotoPageForUserControl("/Source/UI/QQFriends/GoBindQQ.xaml", new object[]
				{
					text
				}, false);
				return;
			}
			if (typeByconv == BindHintManager.BindGuidType.BindPhone)
			{
				ToolFunction.GotoPageForUserControl("/Source/UI/PhoneContact/PhoneNumBinding.xaml", null, false);
				return;
			}
			FaceBookBind.ShowBindPage(page, false);
		}
		public static string GetBindTitle(Conversation conv)
		{
			switch (BindHintManager.GetTypeByconv(conv))
			{
			case BindHintManager.BindGuidType.BindQQ:
				return strings.BindGuide_QQ_Title;
			case BindHintManager.BindGuidType.BindPhone:
				return strings.BindGuide_Phone_Title;
			default:
				return strings.BindGuide_FaceBook_Title;
			}
		}
		public static string GetBindInfo(Conversation conv)
		{
			switch (BindHintManager.GetTypeByconv(conv))
			{
			case BindHintManager.BindGuidType.BindQQ:
				return strings.BindGuide_QQ_Info;
			case BindHintManager.BindGuidType.BindPhone:
				return strings.BindGuide_Phone_Info;
			default:
				return strings.BindGuide_FaceBook_Info;
			}
		}
		public static ImageSource GetBindHead(Conversation conv)
		{
			switch (BindHintManager.GetTypeByconv(conv))
			{
			case BindHintManager.BindGuidType.BindQQ:
				return R.theme.BindQQHeadImg;
			case BindHintManager.BindGuidType.BindPhone:
				return R.theme.BindPhoneHeadImg;
			default:
				return R.theme.BindFaceBookHeadImg;
			}
		}
	}
}
